package modelLayer;
import java.util.ArrayList;

/**
 * Lav en beskrivelse af klassen PartLoan her.
 * 
 * @author (dit navn her)
 * @version (versions nummer eller dato her)
 */
public class PartLoan
{
    private ArrayList<Copy> copyList;
    private Person person;
    private Loan loan;
    
    public PartLoan(Person person, Loan loan)
    {
        this.person = person;
        this.loan = loan;
        copyList = new ArrayList<Copy>();
    }
    
    public void addCopy(Copy c)
    {
        copyList.add(c);
    }
    
    public DVD getDVD()
    {
        return copyList.get(0).getDVD();
    }
    
    public void removeCopy(Copy c)
    {
        copyList.remove(c);
    }
    
    public boolean isEmpty()
    {
        return copyList.size() == 0;
    }
    
    public Person getPerson()
    {
        return this.person;
    }
    
    public Loan getLoan()
    {
        return this.loan;
    }
    
    public boolean hasCopy(Copy copy)
    {
        for(Copy c : copyList)
        {
            if(c == copy)
                return true;
        }
        return false;
    }
}
